import { fileURLToPath, URL } from "node:url";

import { defineConfig } from "vite";
import path from "path";
import vue from "@vitejs/plugin-vue";
import vueDevTools from "vite-plugin-vue-devtools";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueDevTools(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
      imports: ["vue", "pinia"],
      dts: true,
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
  resolve: {
    alias: {
      // 添加一个别名 '@components' 指向 '/src/components' 目录
      "@": path.resolve(__dirname, "./src"),
      // 你可以根据需要添加更多别名
    },
  },
});
